#region Using Directives

using System;
using System.IO;
using Microsoft.Practices.ComponentModel;
using Microsoft.Practices.RecipeFramework;

using EnvDTE;
using EnvDTE80;

#endregion

namespace WiGO.RCX.PF.Actions
{
    /// <summary>
    /// the action to configure Makefile.xc and XCConfig.xml
    /// </summary>
    class GetVariationCSFolderAction : Action
    {
        #region Input Properties

        [Input]
        public string AssetName
        {
            get { return assetName; }
            set { assetName = value; }
        } string assetName;

        [Input]
        public string AssetType
        {
            get { return assetType; }
            set { assetType = value; }
        } string assetType;
        #endregion

        #region Output Properties

        [Output]
        public string ProjectFolder
        {
            get { return projectFolder; }
            set { projectFolder = value; }
        } string projectFolder;

        [Output]
        public string VariationProjectName
        {
            get { return variationProjectName; }
            set { variationProjectName = value; }
        } string variationProjectName;

        [Output]
        public string ProjectNamespace
        {
            get { return projectNamespace; }
            set { projectNamespace = value; }
        } string projectNamespace;

        #endregion

        #region IAction Members

        public override void Execute()
        {
            DTE vs = (DTE)GetService<DTE>(true);
            Solution solution = vs.Solution;
            FileInfo fi = new FileInfo(solution.FileName);

            string varPath = fi.DirectoryName + @"\RobotBase\Variation\Application";
            string nm = "EEst.Pathfinder.Application";
            if (assetType.CompareTo("Application") == 0)
            {
                
            }
            else
            {
                varPath += @"\" + assetType;
                nm += "." + assetType;
            }
            projectFolder = varPath + @"\" + AssetName;
            nm += "." + AssetName;

            variationProjectName = AssetName + "Variation";
            ProjectFolder += "Variation";
            projectNamespace = nm + ".Variation";
        }

        public override void Undo()
        {
            throw new Exception("The method or operation is not implemented.");
        }

        #endregion
    }
}
